package com.frxuexi.myroom.repository

import com.frxuexi.lib_base.room.User
import com.frxuexi.lib_base.room.UserDao
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

@OptIn
class UserRepo @Inject constructor(private val userDao: UserDao) {

    fun register(user: User):Flow<Long>{
        return flow { emit(userDao.register(user)) }
    }

    fun login(name:String,pass:String,role:String):Flow<User>{
        return flow { emit(userDao.login(name, pass, role)) }
    }
}